#ifndef _DSWMESSAGESESSION_H
#define _DSWMESSAGESESSION_H

#include "tcpcombase.h"

class CDswmessagesession : public CTcpcombase
{
public:
	CDswmessagesession();
	virtual ~CDswmessagesession();
public:
	CDswmessagesession(LPST_ENV_T pEnv, struct bufferevent * pBev, int nHeadSize, char* pKey);
//	static CDswmessagesession* createNew(LPST_ENV_T pEnv, struct event_base *base, int nfd, int nHeadSize, char* pKey);
private:
	virtual void SendMsg(char* pMsg){};
	virtual bool ProcessMessage(char* pMsg, int nLen, struct evbuffer *outbuf);
//	void MakeReportPUA(CMarkup &xml);
	virtual void MakeRespXML(const char* pMsgType, CMarkup & xml, int nerrcode){};
	void GetNetWifiParam(CMarkup& xml);
	void GetNetEthParam(CMarkup& xml);
	void GetNetPppoeParam(CMarkup& xml);
	void GetAudioParam(CMarkup& xml);
	void GetVideoParam(CMarkup& xml, int ch_num);
	void GetSystemParam(CMarkup& xml);
	void GetAlarmParam(CMarkup& xml);
	void GetAreCfgParam(CMarkup& xml);
	void GetLocateParam(CMarkup& xml);
	void GetVideoSetParam(CMarkup& xml, int ch_num);

	void SetNetParam(void* pMsg);
	void SetWifiParam(void* pMsg);
	void SetEthParam(void* pMsg);
	void SetPppoeParam(void* pMsg);
	void SetMediaParam(void* pMsg);
	void SetVideoParam(void* pMsg);
	void SetAudioParam(void* pMsg);
	void SetSystemParam(void* pMsg);
	void SetAlarmParam(void* pMsg);
	void SetAreCfgParam(void* pMsg);
	void SetOtherParam(void* pMsg);
	void SetLocateParam(void* pMsg);
	void SetVideoSetParam(void* pMsg);

	int GetDirFile(string & sDirList, char *pDir, int nIndex, int nPageSize, int &nRestCount, bool &bIsDir);
public:
	static void cbGetParamReq(void* pMsgReq,const char* pMsgResp, void* pCaller){((CDswmessagesession*)pCaller)->GetParamReq(pMsgReq, pMsgResp);};
	static void cbSetParamReq(void* pMsgReq,const char* pMsgResp, void* pCaller){((CDswmessagesession*)pCaller)->DealSetParamReq(pMsgReq, pMsgResp);};

	static void cbGetFactoryParamReq(void* pMsgReq,const char* pMsgResp, void* pCaller){((CDswmessagesession*)pCaller)->GetFactoryParamReq(pMsgReq, pMsgResp);};
	static void cbSetFactoryParamReq(void* pMsgReq,const char* pMsgResp, void* pCaller){((CDswmessagesession*)pCaller)->SetFactoryParamReq(pMsgReq, pMsgResp);};

	static void cbGetSdDirListReq(void* pMsgReq,const char* pMsgResp, void* pCaller){((CDswmessagesession*)pCaller)->GetSdDirListReq(pMsgReq, pMsgResp);};

	static void cbGetSdRecFnDownReq(void* pMsgReq,const char* pMsgResp, void* pCaller){((CDswmessagesession*)pCaller)->GetSdRecFnDownReq(pMsgReq, pMsgResp);};

	static void cbGetSdRecFnPlayReq(void* pMsgReq,const char* pMsgResp, void* pCaller){((CDswmessagesession*)pCaller)->GetSdRecFnPlayReq(pMsgReq, pMsgResp);};
	static void cbProcessStopRecVideoReq(void * pRetMsg, const char* pMsgResp, void * pCaller){((CDswmessagesession*)pCaller)->ProcessStopRecVideoReq(pRetMsg, pMsgResp);};
	static void cbProcessSetRecVideoSpdReq(void * pRetMsg, const char* pMsgResp, void * pCaller){((CDswmessagesession*)pCaller)->ProcessSetRecVideoSpdReq(pRetMsg, pMsgResp);};
	static void cbProcessSetRecVideoPosReq(void * pRetMsg, const char* pMsgResp, void * pCaller){((CDswmessagesession*)pCaller)->ProcessSetRecVideoPosReq(pRetMsg, pMsgResp);};
private:
	void GetParamReq(void* pMsgReq, const char* pMsgResp);
	void DealSetParamReq(void * pMsgReq, const char* pMsgResp);

	void GetFactoryParamReq(void* pMsgReq,const char* pMsgResp);
	void SetFactoryParamReq(void* pMsgReq, const char* pMsgResp);

	void GetSdDirListReq(void* pMsgReq, const char* pMsgResp);

	void GetSdRecFnDownReq(void* pMsgReq, const char* pMsgResp);

	void GetSdRecFnPlayReq(void* pMsgReq, const char* pMsgResp);
	void ProcessStopRecVideoReq(void * pRetMsg, const char* pMsgResp);
	void ProcessSetRecVideoSpdReq(void * pRetMsg, const char* pMsgResp);
	void ProcessSetRecVideoPosReq(void * pRetMsg, const char* pMsgResp);
protected:
	char m_sKey[64];
};

#endif

